package SimpleFactory.factory;

import SimpleFactory.bll.AddOperation;
import SimpleFactory.bll.Operation;
import SimpleFactory.bll.SubOperation;

//负责生产不同运算的对象
public class OperationFactory {
	public static Operation createOperation(String option){
		Operation opr=null;
		switch (option){
			case "+":{
				opr=new AddOperation();
				break;
			}
			case "-":{
				opr=new SubOperation();
				break;
			}
			default:throw new RuntimeException("运算符号输入错误");
		}
		return opr;
	}
}
